<admintpl file="header" />
</head>
<body>
	<div class="wrap js-check-wrap">
		<ul class="nav nav-tabs">
			<li class="active"><a href="{:U('Admin/Video/index')}">视频列表</a></li>
			<li><a href="{:U('Admin/Video/add')}">添加视频</a></li>
		</ul>
		<form class="well form-search" id="query_form" method="post" action="{:U('Admin/Video/index')}">
			名称： 
			<input type="text" name="name" style="width: 120px;" value="{$formParam.name}" placeholder="视频名称...">
			分类：
			<select class="select_2" id="typeId" name="typeId" style="width: 90px;">
				<option value='-1'>全部</option>
				<foreach name="types" item="vo">
					<option value="{$vo.typeId}">{$vo.name}</option>
				</foreach>
			</select>
			状态： 
			<select class="select_2" name="status" style="width: 90px;">
				<option value='-1'>全部</option>
				<option value='0' <if condition="$formParam.status eq 0"> selected </if>>下线</option>
				<option value='1' <if condition="$formParam.status eq 1"> selected </if>>上线</option>
				<option value='2' <if condition="$formParam.status eq 2"> selected </if>>转码中</option>
			</select>
			<input type="button" name="query_form_btn" id="queryBtn" data-action="{:U('Admin/Video/index')}" class="btn btn-primary" value="查询" />
		</form>
		<form class="js-ajax-form" action="" method="post">
		<table class="table table-hover table-bordered">
			<thead>
				<tr>
				    <th>ID</th>
					<th>名称</th>
					<th>简介</th>
					<th>是否VR</th>
					<th>分类</th>
					<th>播放次数</th>
					<th>上传时间</th>
					<th>状态</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
				<php>
					 $status = array("0"=>'下线',"1"=>'上线',"2"=>'转码中');
				</php>
				<foreach name="data" item="vo">
				<tr>
				    <td>{$vo.videoId}</td>
					<td>{$vo.name}</td>
					<td style="max-width:160px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="{$vo.introduction}">{$vo.introduction}</td>
					<td><if condition="$vo.category eq 1">否</if>
					<if condition="$vo.category eq 2">是</if></td>
					<td>{$typeName[$vo['typeId']]}</td>
					<td>{$vo.playCount}</td>
					<td>{$vo['createTime']/1000|date='Y-m-d H:i:s', ###}</td>
					<td>{$status[$vo['status']]}</td>
					<td>
						<a href='{:U("Admin/Video/edit", array("videoId"=>number_format($vo["videoId"], 0, "", "")))}'>编辑</a>
						<if condition="$vo.status eq 1"> 
							<a href='{:U("Admin/Video/disable",array("videoId"=>number_format($vo["videoId"], 0, "", "")))}' class="js-ajax-dialog-btn">下线</a>
						</if>
						<if condition="$vo.status eq 0"> 
							<a href='{:U("Admin/Video/enable",array("videoId"=>number_format($vo["videoId"], 0, "", "")))}' class="js-ajax-dialog-btn">上线</a>
						</if>
						<a href='{:U("Admin/VideoComment/index", array("videoId"=>number_format($vo["videoId"], 0, "", ""),"videoName"=>$vo["name"]))}'>评论管理</a>
					</td>
				</tr>
				</foreach>
			</tbody>
		</table>
		</form>
		<div class="pagination">{$page}</div>
	</div>
	<script src="__PUBLIC__/js/common.js"></script>
	<script>
	$(document).ready(function(){
		$('input[name="query_form_btn"]').click(function(){
			 $('#query_form').attr('action', $(this).attr('data-action'));
			 $('#query_form').submit();
		});
		$('#typeId').val({$formParam.typeId});
	});
	</script>
</body>
</html>